package top.wfzzq.dp.abstractFactory;

import java.lang.reflect.Method;

public class OtherDemo {
	public static void main(String[] args) {

		Factory factory = FactoryManger.getFactory(Mircrsoft.class);
		System.out.println(factory.getClass());
		Toy toy = factory.makeToy();
		System.out.println(toy.getClass());
		toy.play();

		factory = FactoryManger.getFactory(Sony.class);
		System.out.println(factory.getClass());
		toy = factory.makeToy();
		System.out.println(toy.getClass());
		toy.play();

		//通过反射获取对象定义的方法
		System.out.println("=====================================");
		Method[] methods = factory.getClass().getDeclaredMethods();
		for (Method method : methods) {
			System.out.println(method);
		}
	}
}
